<?php

namespace Modules\Goods\Entities;

use Illuminate\Database\Eloquent\Model;
use houdunwang\arr\Arr;
class Attr extends Model
{
    protected $guarded = [];


    //设置一个属性的树状图结构方法
    public static function getTreeAttr(){
        $data = self::get()->toArray();
        $attrs = Arr::tree($data,'aname','id','pid');
        return $attrs;
    }
}






